package com.xsir.dto;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xsir.entity.Article;
import lombok.*;

import java.io.Serializable;
import java.util.List;

/**
 * @author user
 * @date 2020/9/10
 */
@Getter
@ToString
@NoArgsConstructor
public class ArticleList implements Serializable{
    /**
     * 文章列表：从数据库获取，不允许set赋值
     */
    private List<Article> list;
    /**
     * 当前页：前端传入
     */
    @Setter
    private Long current;
    /**
     * 总页数：前端传入
     */
    @Setter
    private Long total;
    
    public ArticleList(Page<Article> page) {
        list = page.getRecords();
        current = page.getCurrent();
        total = page.getTotal();
    }
}
